import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { createAppContainer } from 'react-navigation';
import StackNavigator from './StackNavigator';
import SwitchNavigator from './SwitchNavigator';

//创建
const Container = createAppContainer(SwitchNavigator);

export default class AppContainer extends Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    console.log('AppContainer--componentDidMount');
  }
  componentWillUnmount() {
    console.log('AppContainer--componentWillUnmount');
  }

  render() {
    return (
      <View style={{ flex: 1 }}>
        <Container
          ref={(nav) => (this.navigation = nav)}
          onNavigationStateChange={(prevState, currentState, action) => {
            console.log('onNavigationStateChange' + '---------', prevState, currentState, action);
          }}
        />
      </View>
    );
  }
}
